package com.yqy.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yqy.entity.StudentInfo;
import com.yqy.entity.StudentInfoPo;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author yiqianyi
 * @date 2022/3/18 16:21
 */
@Component
public interface StudentInfoMapper extends BaseMapper<StudentInfo> {

    /**
     * 分区域统计学生 用于首页数据展示
     * @return List
     * */
    @Select(value = " SELECT SUBSTRING(address,1,2) AS address,COUNT(*) AS num FROM t_student_info GROUP BY SUBSTRING(address,1,2)")
    List<StudentInfoPo> findUserByAddressCount();
}
